<template>
  <!-- 合纵119盟友倾情连线 -->
  <div class="allyConnectOut">
    <div class="title">
      <img src="../assets/img/119盟友连线title.png" alt="" />
    </div>
    <ul>
      <li v-for="(v, i) in dataList" :key="i">
        <div class="bgImg"></div>
        <div class="bgText">
          <p class="font28">{{ v.gmvWithUnit }}</p>
          <p class="font18">(万元)</p>
        </div>
        <p class="name">{{ v.name }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
import url from "../api/apiUrl";
import { getRequest } from "../api/indexGet";
export default {
  data() {
    return {
      dataList: [],
      totalAxios: null,
    };
  },
  created() {
    this.getList();
    this.intervalAxios();
  },
  methods: {
    async getList() {
      let res = await getRequest(url.allyGmvOut);
      if (res.data.code == "000000") {
        this.dataList = res.data.content;
        // this.dataList.map(obj=>{
        //   obj.gmvWithUnit=this.$parent.toThousands(obj.gmvWithUnit)
        // })
      }
    },
    // 1s请求一次
    intervalAxios() {
      this.totalAxios = setInterval(() => {
        this.getList();
      }, 4000);
    },
  },
  destroyed() {
    clearInterval(this.totalAxios);
  },
};
</script>

<style lang="less" scoped>
.allyConnectOut {
  margin-right: 97px;
  .title {
    margin-top: -100px;
  }
  ul {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    width: 363px;
    li:nth-child(odd) {
      .bgImg {
        transform: rotate(360deg);
        animation: rotation 8s linear infinite;
      }
    }
    li:nth-child(even) {
      .bgImg {
        transform: rotate(0);
        animation: rotation2 8s linear infinite;
      }
    }
    li {
      position: relative;
      .bgImg {
        width: 140px;
        height: 140px;
        background: url("https://image.hezongyy.com/pcimage/20211109img/screen_bd1.png")
          no-repeat center;

        margin: 3px auto 0;
        background-size: 100% 100%;
      }
      .bgText {
        width: 140px;
        height: 140px;
        position: absolute;
        display: flex;
        flex-direction: column;
        justify-content: center;
        top: 0;
        p {
          font-size: 28px;
          text-align: center;
          color: #00d0ff;
          line-height: 30px;
        }
        .font28 {
          font-size: 28px;
        }
        .font18 {
          font-size: 18px;
        }
      }
      .name {
        text-align: center;
        color: #e2ebf1;
        font-size: 18px;
        margin-top: 12px;
      }
    }
  }
  @keyframes rotation {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
  @keyframes rotation2 {
    from {
      transform: rotate(360deg);
    }
    to {
      transform: rotate(0deg);
    }
  }
}
</style>